package me.zk.practice1.hw;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author zhangkai
 * @date 2023/8/8 15:27
 */
public class HWBJ01 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = Integer.parseInt(scanner.nextLine());

        int[] nums = new int[n];

        for (int i = 0; i < n; i++) {
            nums[i] = scanner.nextInt();
        }
        int count = nums[0];
        for (int i = 1; i < n; i++) {
            count^=nums[i];
        }
        int res = -1;
        if (count == 0) {
            int min = Arrays.stream(nums).min().getAsInt();

            int total = Arrays.stream(nums).sum();

            res = total-min;
        }
        System.out.println(res);
    }
}
